import request from './config/request'
import mockRequest from './config/mockRequest'
import type { ApiResponse } from './type'

export interface IUserLoginData {
  username: string
  password: string
}

export interface ILoginResponseData {
  token: string
}
// 登录接口
export const login = (
  data: IUserLoginData
): Promise<ApiResponse<ILoginResponseData>> => {
  return request.post('/auth/login', data)
}
export const loginMock = (
  data: IUserLoginData
): Promise<ApiResponse<ILoginResponseData>> => {
  return mockRequest.post('/auth/login', data)
}

export interface IUserInfoResponseData {
  name: string
  phone: number
  [key: string]: unknown
}
export const userInfGetMock = (
  params?: unknown
): Promise<ApiResponse<IUserInfoResponseData>> => {
  return mockRequest.get('/user-info/get', { params })
}
